package com.zkthink.ceres.promotion.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 *
 * </p>
 *
 * @author JustArgo
 * @since 2020-06-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_promotion_stat")
@ApiModel(value = "PromotionStat", description = "")
@AllArgsConstructor
public class PromotionStat extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 活动id
     */
    @ApiModelProperty(value = "活动id")
    @NotNull(message = "活动id不能为空")
    @TableField("promotion_id")
    @Excel(name = "活动id")
    private Long promotionId;

    /**
     * 商户编号
     */
    @ApiModelProperty(value = "商户编号")
    @NotEmpty(message = "商户编号不能为空")
    @TableField(value = "tenant_code", condition = LIKE)
    @Excel(name = "商户编号")
    private String tenantCode;

    /**
     * 店铺名称
     */
    @ApiModelProperty(value = "店铺名称")
    @NotEmpty(message = "店铺名称不能为空")
    @Length(max = 255, message = "店铺名称长度不能超过255")
    @TableField(value = "store_name", condition = LIKE)
    @Excel(name = "店铺名称")
    private String storeName;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @NotNull(message = "用户id不能为空")
    @TableField("mid")
    @Excel(name = "用户id")
    private Long mid;

    /**
     * 订单编号
     */
    @ApiModelProperty(value = "订单编号")
    @NotEmpty(message = "订单编号不能为空")
    @Length(max = 32, message = "订单编号长度不能超过32")
    @TableField(value = "order_code", condition = LIKE)
    @Excel(name = "订单编号")
    private String orderCode;

    /**
     * 支付状态 1-已支付 0-未支付
     */
    @ApiModelProperty(value = "支付状态 1-已支付 0-未支付")
    @NotNull(message = "支付状态 1-已支付 0-未支付不能为空")
    @TableField("is_payed")
    @Excel(name = "支付状态 1-已支付 0-未支付")
    private Integer isPayed;

    /**
     * 订单金额，此处为子订单
     */
    @ApiModelProperty(value = "订单金额，此处为子订单")
    @NotNull(message = "订单金额，此处为子订单不能为空")
    @TableField("order_sum")
    @Excel(name = "订单金额，此处为子订单")
    private Long orderSum;

    /**
     * 是否删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "是否删除 1-删除 0-未删除")
    @NotNull(message = "是否删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "是否删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public PromotionStat(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime,
                         Long promotionId, Long mid, String orderCode, Integer isPayed, Long orderSum, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.promotionId = promotionId;
        this.mid = mid;
        this.orderCode = orderCode;
        this.isPayed = isPayed;
        this.orderSum = orderSum;
        this.isDelete = isDelete;
    }

}
